package org.simple.framework.service.flow.choreographer;

import java.util.Arrays;
import java.util.List;

import org.simple.framework.service.config.BizConfig;

import com.simple.framework.infrastructure.pojo.Flow;
import com.simple.framework.infrastructure.pojo.FlowStep;

/**
 * 简单业务编排器
 * 
 * @author wujiangpo
 *
 */
public class SingleChoreographer extends AbstractFlowChoreographer {

	@Override
	public Flow createFlow(String bizs) {

		List<String> bizList = Arrays.asList(bizs.split(","));

		Flow flow = new Flow();
		FlowStep FlowStep1 = flowStepService.getFlowStepByFlowStepId("基本流程步骤id");
		FlowStep FlowStep2 = flowStepService.getFlowStepByFlowStepId("宙斯流程步骤id");

		addFlowStep(flow, FlowStep1);

		for (BizConfig bizConfig : BizConfig.values()) {
			if (bizList.contains(bizConfig.getValue())) {
				addFlowStep(flow, FlowStep2, bizConfig.getName());
			}
		}
		return flow;
	}

}
